var reverseN = function (head, n) {
  if (head == null || head.next == null) {
    return head;
  }
  let pre = null; cur = head; nxt = head.next;
  while (n--) {
    cur.next = pre;
    pre = cur;
    cur = nxt;
    if (nxt != null) {
      nxt = nxt.next;
    }
  }
  // 此时的 cur 是第 n + 1 个节点，head 是反转后的尾结点
  head.next = cur;
  // 此时的 pre 是反转后的头结点
  return pre;
}